#!/usr/bin/python

import pyinotify
import time
import os

class ProcessTransientFile(pyinotify.ProcessEvent):
    def process_IN_MOVED_TO(self,event):
        print("moved to ")
    def process_IN_MODIFY(self,event):
        print("changing something")
        line = f.readline()
        if line:
            print(line)
filename = '/opt/watermark/wm.ini'
f = open(filename,'r')
st_results = os.stat(filename)
st_size = st_results[6]
f.seek(st_size)
print(st_size)

wm = pyinotify.WatchManager()
notifier = pyinotify.Notifier(wm)
wm.watch_transient_file(filename,pyinotify.IN_MODIFY|pyinotify.IN_MOVED_TO, ProcessTransientFile)
notifier.loop()
